<template>
<div class="huiyuandetail">
  <p class="names"><img :src="src" alt="" width="30"><span>{{accountGoods.userName}}</span></p>
  <p class="imgid"><img :src="accountGoods.coverImg | imgPathFilter" alt="" width="100%"><span>NO.{{accountGoods.vipCardNo}}</span></p>
  <wv-panel>
    <wv-media-box
      :thumb="thumb"
      title="24小时服务热线"
      :description="accountGoods.hoursHotline" class="hotline"
    />
    <wv-media-box
      :thumb="thumb1"
      title="机场监督专线"
      :description="accountGoods.airportPhone" class="hotline"
    />
  </wv-panel>
  <p class="myquanyi">我的权益</p>
  <div>
    <ul class="quanyilist" v-for="(item,index) in accountGoods.cardServerList" v-if="index==0">
      <li>
        <img :src="item.serverImg | imgPathFilter" alt="" width="18">{{item.serverName}}
      </li>
      <li v-html="item.serverDesc"></li>
      <li v-html="'有效期 终身'" v-if="item.validDayType==1"></li>
      <li v-html="'有效期'+item.initDate+'--'+item.expireDate" v-else></li>
    </ul>
    <div v-if="isshow">
      <ul class="quanyilist" v-for="(item,index) in accountGoods.cardServerList" v-if="index>0">
        <li>
          <img :src="item.serverImg | imgPathFilter" alt="" width="18">{{item.serverName}}
        </li>
        <li v-html="item.serverDesc"></li>
        <li v-html="'有效期 终身'" v-if="item.validDayType==1"></li>
        <li v-html="'有效期'+item.initDate+'--'+item.expireDate" v-else></li>
      </ul>
    </div>
    <p class="shouqi" v-show="!isshow" @click="isshow=true"><img :src="zhankai" alt=""> 展开更多 </p>
    <p class="shouqi" v-show="isshow" @click="isshow=false"><img :src="shouqi" alt=""> 收起更多 </p>
  </div>
  <p class="myquanyi">我的信息</p>
  <wv-group class="mymsg">
    <div v-show="isvisible">
      <wv-cell title="姓名" :value="accountGoods.userName"></wv-cell>
      <wv-cell title="手机号" :value="accountGoods.mobile"></wv-cell>
      <wv-cell title="公司名称" :value="accountGoods.companyName"></wv-cell>
      <wv-cell title="地址" :value="accountGoods.companyAddress"></wv-cell>
      <wv-cell title="应急电话" :value="accountGoods.telePhone"></wv-cell>
      <wv-cell title="发卡地区" :value="accountGoods.airportName"></wv-cell>
      <wv-cell title="发卡日期" :value="accountGoods.buyDate"></wv-cell>
      <div class="beizhu" v-if="accountGoods.remark!=''">
        <p>备注</p>
        <div>{{accountGoods.remark}}</div>
      </div>
    </div>
  </wv-group>

  <p class="shouqi last" v-show="!isvisible" @click="isvisible=true"><img :src="zhankai" alt=""> 展开更多 </p>
  <p class="shouqi last" v-show="isvisible" @click="isvisible=false"><img :src="shouqi" alt=""> 收起更多 </p>
  <p class="offer" @click="goEnter()" v-if="type==1">确定</p>
  <p class="offer" @click="goBack()" v-if="type==2">返回</p>
</div>
</template>

<script type="text/ecmascript-6">
  import {getVipcardServerDetail} from '../../../test/unit/http'

  export default {
    name: 'yaofangka',
    props: {},
    data() {
      return {
        src: require('../../assets/huangguan.png'),
        img: require('../../assets/jinkabanner.png'),
        thumb: require('../../assets/hour.png'),
        thumb1: require('../../assets/hot.png'),
        thumb2: require('../../assets/tousu.png'),
        thumb3: require('../../assets/smallerweima.png'),
        quanyiimg: require('../../assets/fuwu.png'),
        yanwuxian: require('../../assets/baoxian.png'),
        dianzi: require('../../assets/dainzi.png'),
        jifen: require('../../assets/jifen.png'),
        shouqi: require('../../assets/shouqi.png'),
        zhankai: require('../../assets/xiala.png'),
        isshow: false,
        isvisible: false,
        accountGoods: {},
        type:1
      };
    },
    methods: {
      goSaomaDetail(accountGoodsId) {
        this.$router.push({path: 'saomadetail', query: {accountGoodsId: accountGoodsId}})
      },
      goBack() {
        this.$router.push({path:'myguibinka'});
      },
      goEnter(){
        this.$router.push({path:'index'});
      }
    },
    created() {
      var accountGoodsId = this.$route.query.accountGoodsId;
      this.type = this.$route.query.type;
      getVipcardServerDetail({accountGoodsId: accountGoodsId}).then(res => {
        console.log(res);
        if (res.code == 100) {
          this.accountGoods = res.object;
          console.log(this.accountGoods)
        }
      })
    },
    components: {}
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  .names {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    text-align: left;
    padding: 10px;
    img {
      vertical-align: text-bottom;
      margin-right: 10px;
    }
  }

  .huiyuandetail {
    text-align: left;
    .weui-panel:before {
      border-top: none;

    }
    .myquanyi {
      font-size: 20px;
      font-weight: 700;
      color: #111;
      padding-left: 15px;

    }
    .imgid {
      position: relative;
      span {
        position: absolute;
        top: 37px;
        right: 28px;
        color: #7b4813;
        font-weight: 700;
      }
    }
    .quanyilist {
      padding: 15px;
      color: #999;
      line-height: 25px;
      text-align: left;
      li:first-child {
        color: #111;
        font-size: 16px;
        img {
          margin-right: 5px;
          vertical-align: text-bottom;
        }
      }
      li:nth-child(2) {
        margin: 5px 0;
      }
    }
    .shouqi {
      text-align: center;
      margin: 10px 0;
    }
    .last {
      padding-bottom: 70px;
    }
    .offer {
      position: fixed;
      bottom: 0;
      width: 100%;
      background-image: linear-gradient(to left, #4c92ed, #61beec);
      height: 50px;
      line-height: 50px;
      color: #fff;
      text-align: center;
      z-index: 999;
    }
    .beizhu {
      margin: 15px;
      padding: 10px 0;
      border-top: 1px solid #e5e5e5;
      color: #111;
      p {
        color: #666;
        margin-bottom: 10px;
      }
    }
  }

</style>
